package com.mac.userinfo.login.action;

import com.mac.common.util.BusinessException;
import com.mac.common.util.ExcelUtil;
import com.mac.userinfo.login.service.IUserLoginService;
import org.apache.catalina.servlet4preview.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletResponse;
import java.security.Principal;
import java.util.HashMap;
import java.util.Map;

/**
 * 登陆控制器
 * @author macao
 */
@Controller
public class LoginAction {
    private final Logger log =  LoggerFactory.getLogger(this.getClass());

    @RequestMapping({"/", "/login"})
    public String login(Model model) {
        model.addAttribute("loginError", false);
        return "views/userinfo/login/login";
    }

    @RequestMapping("/loginError")
    public String loginError(Model model) {
        model.addAttribute("loginError", true);
        return "views/userinfo/login/login";
    }

    @RequestMapping("/session_expired")
    public String sessionExpired(Model model) {
        model.addAttribute("loginError", true);
        return "views/userinfo/login/session_expired";
    }

}
